// 简化的国际化配置
export const locales = ['zh', 'en', 'ja', 'ko'] as const;
export const defaultLocale = 'zh' as const;

export type Locale = typeof locales[number];

// 翻译消息
export const messages = {
  zh: {
    Navigation: {
      home: '首页',
      cars: '车辆展示',
      brands: '品牌中心',
      about: '关于我们',
      login: '登录',
      dashboard: '管理后台',
      logout: '退出登录'
    },
    Common: {
      search: '搜索车辆...',
      language: '语言',
      all: '全部',
      new: '新车',
      used: '二手车',
      electric: '电动车',
      gasoline: '燃油车',
      hybrid: '混合动力',
      price: '价格',
      brand: '品牌',
      type: '类型',
      fuel: '燃料类型'
    },
    Footer: {
      company: 'AutoShow 汽车展示',
      description: '专业的汽车进出口贸易平台',
      contact: '联系我们',
      address: '地址：上海市浦东新区汽车大道123号',
      phone: '电话：+86 21 1234 5678',
      email: '邮箱：info@autoshow.com',
      rights: '© 2024 AutoShow. 保留所有权利。'
    }
  },
  en: {
    Navigation: {
      home: 'Home',
      cars: 'Cars',
      brands: 'Brands',
      about: 'About',
      login: 'Login',
      dashboard: 'Dashboard',
      logout: 'Logout'
    },
    Common: {
      search: 'Search cars...',
      language: 'Language',
      all: 'All',
      new: 'New',
      used: 'Used',
      electric: 'Electric',
      gasoline: 'Gasoline',
      hybrid: 'Hybrid',
      price: 'Price',
      brand: 'Brand',
      type: 'Type',
      fuel: 'Fuel Type'
    },
    Footer: {
      company: 'AutoShow Car Display',
      description: 'Professional Automotive Import & Export Platform',
      contact: 'Contact Us',
      address: 'Address: 123 Auto Avenue, Pudong, Shanghai',
      phone: 'Phone: +86 21 1234 5678',
      email: 'Email: info@autoshow.com',
      rights: '© 2024 AutoShow. All rights reserved.'
    }
  },
  ja: {
    Navigation: {
      home: 'ホーム',
      cars: '車両展示',
      brands: 'ブランド',
      about: '会社概要',
      login: 'ログイン',
      dashboard: 'ダッシュボード',
      logout: 'ログアウト'
    },
    Common: {
      search: '車を検索...',
      language: '言語',
      all: 'すべて',
      new: '新車',
      used: '中古車',
      electric: '電気自動車',
      gasoline: 'ガソリン車',
      hybrid: 'ハイブリッド',
      price: '価格',
      brand: 'ブランド',
      type: 'タイプ',
      fuel: '燃料タイプ'
    },
    Footer: {
      company: 'AutoShow 車両展示',
      description: 'プロフェッショナルな自動車輸出入プラットフォーム',
      contact: 'お問い合わせ',
      address: '住所：上海市浦東新区自動車通り123号',
      phone: '電話：+86 21 1234 5678',
      email: 'メール：info@autoshow.com',
      rights: '© 2024 AutoShow. 全著作権所有。'
    }
  },
  ko: {
    Navigation: {
      home: '홈',
      cars: '차량 전시',
      brands: '브랜드',
      about: '회사 소개',
      login: '로그인',
      dashboard: '대시보드',
      logout: '로그아웃'
    },
    Common: {
      search: '차량 검색...',
      language: '언어',
      all: '전체',
      new: '신차',
      used: '중고차',
      electric: '전기차',
      gasoline: '가솔린',
      hybrid: '하이브리드',
      price: '가격',
      brand: '브랜드',
      type: '유형',
      fuel: '연료 유형'
    },
    Footer: {
      company: 'AutoShow 차량 전시',
      description: '전문 자동차 수출입 플랫폼',
      contact: '연락처',
      address: '주소: 상하이시 푸동신구 자동차대로 123호',
      phone: '전화: +86 21 1234 5678',
      email: '이메일: info@autoshow.com',
      rights: '© 2024 AutoShow. 모든 권리 보유.'
    }
  }
};

// 简化的语言切换函数
export const getTranslation = (locale: Locale, key: string) => {
  const keys = key.split('.');
  let value: any = messages[locale];
  
  for (const k of keys) {
    value = value?.[k];
    if (value === undefined) return key;
  }
  
  return value || key;
};